package com.yunxiangyue

import android.view.View
import android.view.ViewGroup
import androidx.viewpager.widget.PagerAdapter

class RegisterAddForgetAdapter :PagerAdapter{

    private lateinit var viewList:List<View>
    private lateinit var fragementTitle:List<String>

    constructor(viewList: List<View>, fragementTitle: List<String>) : super() {
        this.viewList = viewList
        this.fragementTitle = fragementTitle
    }


    override fun getCount(): Int {
        return viewList.size
    }

    override fun isViewFromObject(view: View, `object`: Any): Boolean {
        return view ==`object`
    }

    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        container.addView(viewList.get(position))
        return viewList.get(position)
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
        container.removeView(viewList.get(position))
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return fragementTitle.get(position)
    }
}